package com.kangkang.tmockito;

public class UserService {

    private final UserDao userDao;
    private User user;
    
    public UserService(UserDao userDao) {
        this.userDao = userDao;
    }

    public boolean update(int id, String name) {
        User user = userDao.getUser(id);
        if (user == null) {
            return false;
        }

        User userUpdate = new User(user.getId(), name);
        return userDao.update(userUpdate);
    }

}
